package com.zhy.http.okhttp;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.zhy.http.library.callback.Callback;

import okhttp3.Response;

import java.io.IOException;
import java.util.List;

/**
 * Created by zhy on 15/12/14.
 */
public abstract class ListUserCallback extends Callback<List<User>> {
    @Override
    public List<User> parseNetworkResponse(Response response, int id) throws IOException {
        String string = response.body() != null ? response.body().string() : null;
        Gson gson = new Gson();
        return gson.fromJson(string, new TypeToken<List<User>>() {}.getType());
    }
}
